﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace test1
{
    public partial class Form1 : Form
    {
        System.Timers.Timer t;
        int iCount = 0;

        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            t = new System.Timers.Timer();
            t.AutoReset = true;
            t.Interval = 1000;
            t.Elapsed += new System.Timers.ElapsedEventHandler(t_Elapsed);
            t.SynchronizingObject = this;
            //t.Tick += new EventHandler(t_Tick);
            t.Enabled = true;
        }

        void t_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
        {
            iCount++;
            this.Text = iCount.ToString();
        }

        void t_Tick(object sender, EventArgs e)
        {
            iCount++;
            this.Text = iCount.ToString();
        }

    }
}